<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>审核文章</title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <script src="/js/vue3.js"></script>
    <script src="/js/axios.min.js"></script>
</head>

<body>

    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">文章管理</a></li>
            <li><a href="#">审核文章</a></li>
        </ul>
    </div>
    <div class="formbody" id="box">
        <!-- 工具栏 -->
        <div class="tools">
            <ul class="toolbar">
                <li v-on:click="goback"><span><img src="/images/t04.png" /></span>返回</li>
            </ul>
        </div>
        <form id="uploadForm">
            <div class="formtitle"><span>审核文章</span></div>
            <ul class="forminfo">
                <li>
                    <label>文章ID</label>
                    <input v-model="currentPageData.aid" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>文章标题</label>
                    <input v-model="currentPageData.title" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>文章图片</label>
                    <img v-bind:src="'/'+currentPageData.artimg" style="width:100px;heigh:100px;" />
                </li>
                <li>
                    <label>文章关键字</label>
                    <input v-model="currentPageData.keywords" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>发布时间</label>
                    <input v-model="currentPageData.createtime" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>博客用户ID</label>
                    <input v-model="currentPageData.bloguid" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>内容</label>
                    <textarea v-model="currentPageData.content" type="text" class="dfinput"
                        readonly="readonly"></textarea>
                </li>
                <li>
                    <label>状态</label>
                    <input v-model="currentPageData.astatus" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>备注</label>
                    <input v-model="currentPageData.remark" type="text" class="dfinput" readonly="readonly" />
                </li>
                <li>
                    <label>审核意见</label>
                    <textarea v-model="msg" type="text" class="dfinput"></textarea>
                </li>
            </ul>
            <input type="button" class="scbtn" v-on:click="successButton" value="通过">
            &nbsp;
            <input type="button" class="scbtn" v-on:click="errorButton" value="不通过">
            &nbsp;
            <input type="button" class="scbtn" v-on:click="report" value="上报">
        </form>
    </div>
</body>

<script>
    var obj = {
        data () {
            return {
                currentPageData: [], //当前页显示内容
                msg: '无评价', // 审核信息
            }
        },
        mounted () {
            var paras = location.search; //search获得地址中的参数，内容为'?itemId=12'
            var temp = paras.split('=');
            var itemId = temp[1];
            axios({
                method: 'get',
                url: '/blog/checkEmp/' + itemId,
            }).then(function (result) {
                vm.currentPageData = result.data.data;
            });
        },
        methods: {
            successButton () {
                axios({
                    method: 'put',
                    url: '/blog/checkEmp/' + this.currentPageData.aid + "/1/" + vm.msg,
                    // data: {
                    //     msg: this.msg
                    // }
                }).then(function (result) {
                    if (result.code == -1) {
                        window.alert(result.data.msg);
                    } else {
                        window.alert(result.data.msg);
                        setTimeout(function () {
                            window.location.href = "/admin_article_manage/article_list.html";
                        }, 500);
                    }
                });
            },
            errorButton () {
                axios({
                    method: 'put',
                    url: '/blog/checkEmp/' + this.currentPageData.aid + "/-1/" + vm.msg,
                    // data: {
                    //     msg: vm.msg
                    // }
                }).then(function (result) {
                    window.alert(result.data.msg);
                    if (result.data.code == 0) {
                        setTimeout(function () {
                            window.location.href = "/admin_article_manage/article_list.html";
                        }, 500);
                    }
                });
            },
            report () {
                axios({
                    method: 'put',
                    url: '/blog/checkEmp/' + this.currentPageData.aid,
                }).then(function (result) {
                    window.alert(result.data.msg);
                    if (result.data.code == 0) {
                        setTimeout(function () {
                            window.location.href = "/admin_article_manage/article_list.html";
                        }, 500);
                    }
                });
            },
            goback () {
                window.history.back();
            }
        }
    }
    var vm = Vue.createApp(obj).mount("#box")
</script>

</html>